package com.demo.rabbitmq.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class MultiServerConsumer {

    @RabbitListener(id = "direct_first_queue", queues = "multi_server_queue1", containerFactory = "firstRabbitListenerContainerFactory")
    public void directFirstExchange(String content) {
        log.info("消费者1，消费消息内容：{}", content);
    }

    @RabbitListener(id = "direct_second_queue", queues = "multi_server_queue2", containerFactory = "secondRabbitListenerContainerFactory")
    public void directSecondExchange(String content) {
        log.info("消费者2，消费消息内容：{}", content);
    }
}
